package com.sun.sort.hill;


import java.util.Arrays;


public class hill2 {
    public static void main(String[] args) {
        int[] arr = {8,9,1,7,2,3,5,4,6,0};

        for (int gap = arr.length / 2;gap > 0;gap /= 2){
            for (int i = gap; i < arr.length; i++) {
                int index = i;
                int value = arr[index];
                if (value < arr[index - gap]){
                    while ((index - gap) >= 0&& value < arr[index - gap]){
                        arr[index] = arr[index - gap];
                        index -= gap;
                    }
                    arr[index] = value;
                }
            }
        }
        System.out.println(Arrays.toString(arr));

    }
}
